package cn.com.ctbri.geomonitor.service;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.identity.Group;
import org.activiti.engine.identity.User;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Attachment;
import org.activiti.engine.task.Comment;
import org.activiti.engine.task.Task;
import org.springframework.web.multipart.MultipartFile;

import cn.com.ctbri.geomonitor.bean.CommentVO;
import cn.com.ctbri.geomonitor.bean.FormField;
import cn.com.ctbri.geomonitor.bean.ProXuanZhiForm;
import cn.com.ctbri.geomonitor.bean.ProcessVO;
import cn.com.ctbri.geomonitor.bean.TaskVO;
import cn.com.ctbri.geomonitor.bean.VacationForm;
import cn.com.ctbri.geomonitor.bean.departmentTask;
import cn.com.ctbri.geomonitor.model.Program;

public interface ProcessRestService {
	/**
	 * 启动一个请假流程
	 * @param vacation
	 * @return
	 */
//	ProcessInstance startVacation(VacationForm  vacation,MultipartFile[] file
//	,HttpServletRequest request);
	/**
	 * 启动一个项目选址意见书申请流程
	 * @param vacation
	 * @return
	 */
	//ProcessInstance startProXuanZhi(MultipartFile[] file,ProXuanZhiForm proXuanZhiForm,HttpServletRequest request );
	//启动流程
	ProcessInstance startProcess(MultipartFile[] file,String type,HttpServletRequest request ,String userID,String programName);

	//查询请假申请
	public List<ProcessVO> listVacation(String userId);
	//获取流程图
	InputStream getDiagram(String processInstanceId);
	// 查询用户的待办任务
	public List<TaskVO> listTasks(String userId) ;
	// 附件下载查询
	public List<Attachment> getAttachments(String pi) ;
	
	public List<ProcessVO> listProXuanZhi(String userId);
			
	// 查询用户所受理的全部任务
	public List<TaskVO> listAssigneeTasks(String userId) ;
	// 领取任务
	public void claim(String taskId, String userId);
	// 查询一个任务所在流程的全部评论
	public List<CommentVO> getComments(String taskId);
	//根据pi查询评论
	public List<CommentVO> getCommentsByPi(String pi) ;
	// 查询一个任务所在流程的开始表单信息
	public List<FormField> getFormFields(String taskId);
	// 审批通过任务
	public void complete(String taskId, String userid);
	//规划局窗口项目选址意见书完成
	public void complete1(MultipartFile[] file,String taskId, String type, String userid,HttpServletRequest request,String programType,String programName,String userID,String content);
	//获取用户的全部申请
	public List<TaskVO> getAllApply(String userID) ;		
	//根据流程实例获取申请
	public List<Program> getApplyByPi(String pi) ;		
		
	//查询已经完成的流程
	public List<HistoricProcessInstance> getFinishedFlow( String type) ;
	
	
	//program转换
	public List<TaskVO> formatProgram(List<HistoricProcessInstance> programs);
	
	//查询已经完成的流程
		public List<HistoricProcessInstance> getFinishiedFlowByUserId(String userId) ;
		
		//查询已经完成的流程
				public List<HistoricProcessInstance> getFinishedFlowByType(String type) ;
	
	//更新附件

	String updateAttachment(MultipartFile[] file, String url, HttpServletRequest request, String taskId);
	
	public Group getGroupID(String userId) ;
	
	//根据用户的ID查找执行的历史流程
	
	public List<departmentTask> getHistoryOfTask(String userID);
	
	//根据ProInstId查找Program
	public Program getProgramByProInstId(String proInstId);
	
	//根据proInstId查找一个流程的所有的任务
	public List<HistoricTaskInstance> getTheDetailOfFlowByProInstId(String proInstId);
}

